<%@ include file="/common/taglibs.jsp"%>

<probiz:pageHeading pageHeadingKey="menu.shippingMethod" />

	
<content tag="buttons">
	<probiz:iconBtn btnType="add"  url="${ctxPath}/system/shippingMethod.html?doAction=add&from=list" />	
	<probiz:iconBtn btnType="delete" onclick="return fnDoMultiDelete(this);" />
</content>

		
<form  class="mainForm" name="shippingMethodListFrm" method="post">
	<div class="top clearfix">
		<ul class="tab">
			<li class="curr"><span><fmt:message key="menu.shippingMethodList"/></span></li>
		</ul>
		<%@include file="/common/pagingOnlyTop.jsp"%>
	</div>
	<div class="data">
			<input type="hidden" name="doAction" value="" />
			
			<div id="shippingMethodListTable">
			<c:set var="checkAll">
				<input type="checkbox" name="allbox" onclick="checkAll(this.form)" class="checkbox" />
			</c:set>
			<display:table name="${shippingMethodList}" cellspacing="0" cellpadding="0" uid="shippingMethod" 
			class="list_table" export="false" requestURI="" style="width:100%">
				<display:column class="checkbox_column" title="${checkAll}" media="html">
					<input type="checkbox" name="multiIds" value="${shippingMethod.shippingMethodId}" class="checkbox" title="${shippingMethod.shippingMethodName}"/>
				</display:column>
				<display:column sortable="true" headerClass="data-table-title" style="width:15%"
	        		decorator="com.probiz.estore.core.decorator.TblColumnDecorator" titleKey="shippingMethod.shippingMethod">
	        		<a href="shippingMethod.html?shippingMethodId=${shippingMethod.shippingMethodId}&doAction=edit">${shippingMethod.shippingMethodName}</a>
	        	</display:column>
	        	<display:column sortable="false" headerClass="data-table-title" style="width:25%"
	        		decorator="com.probiz.estore.core.decorator.TblColumnDecorator" titleKey="shippingMethod.shippingRegion">
	        		<span class="handle"></span><a href="javascript:;" onclick="dlgEditShippingRate_show({shippingMethodId:${shippingMethod.shippingMethodId}},'GET');"><fmt:message key="shippingMethod.addRegion"/></a>
	        		<br/>
	        		<c:forEach items="${shippingMethod.shippingRates}" var="shippingRate" varStatus="shippingRateStatus">
					<ul>
						<li>
							<span class="view"></span>${shippingRateStatus.index+1}.
							<a href="javascript:;" onclick="dlgEditShippingRate_show({shippingRateId:${shippingRate.shippingRateId}},'GET');">
								${(not empty shippingRate.region)?shippingRate.region.fullName:'x'}
							</a>
						</li>
					</ul>	
				</c:forEach>
	        	</display:column>
	        	<display:column sortable="true" headerClass="data-table-title"  style="width:8%"
	        		decorator="com.probiz.estore.core.decorator.TblColumnDecorator" titleKey="shippingMethod.belong2company">
					<c:if test="${not empty shippingMethod.carrier}">
					 <a href="carrier.html?doAction=edit&carrierId=${shippingMethod.carrier.carrierId}&from=shippingMethods">${shippingMethod.carrier.carrierName}</a>       		
	        		</c:if>
	        	</display:column>
	        	<display:column sortable="true" headerClass="data-table-title"  style="width:5%"
	        		decorator="com.probiz.estore.core.decorator.TblColumnDecorator" titleKey="carrier.status">
	        		<c:if test="${shippingMethod.status==1}" ><fmt:message key="status.active"/></c:if>
					<c:if test="${shippingMethod.status==2}" ><fmt:message key="status.inactive"/></c:if>
	        	</display:column>
	        	<display:column sortable="false" headerClass="data-table-title"
	        		decorator="com.probiz.estore.core.decorator.TblColumnDecorator" titleKey="shippingMethod.desc">
	        		${shippingMethod.shippingMethodDetail}
	        	</display:column>
			</display:table> 
			<%@include file="/common/pagingOnly.jsp"%>
			</div>
	</div>
</form>
<c:set var="plugin_upload" value="true" scope="request"/>
<c:set var="plugin_tree" value="true" scope="request"/>
<script type="text/javascript">
$j(document).ready(function () {
	highlightTableRows("shippingMethod");
});	
</script>

<!-- *************** shippingRateForm.jsp引用：Begin *************** -->
<script type="text/javascript">
    var isDelete=false;
    //function fnInitEditShippingRateForm(){}
    function fnInitADDShippingRateForm(){}
	function fnSaveShippingRate(){	
    	var form=$j("#shippingRateForm");
    	var e;
    	var isPass=validateShippingRate(form.get(0));
    	if(isPass){
    		if(isDelete&&confirm(__FMT.common_message_confirmDeleteThis)) {
    			e=createFormElement(form.get(0),"input",null,"delete","hidden","delete");
    		}
    		function fnCloseDlgShippingRate(){
    			if(isPass){
			    	window.location.href=window.location.href;
			   		//$j("#shippingMethodListTable").load("${ctxPath}/system/shippingMethod/dialog.html?doAction=getListTable&showingCarrierId=${param.showingCarrierId}");
			   		dlgEditShippingRate_close();
		   		}
		    }
    		var paramData=form.serializeArray();    	
    		$j.post("${ctxPath}/system/shippingRateBean/dialog.html?doAction=save",paramData,fnCloseDlgShippingRate);
    		isDelete=false;
    		if(e) form.get(0).removeChild(e);
    	}
    }
    function fnDeleteShippingRate(){
    	isDelete=true;
    	fnSaveShippingRate();
    }
    //log("${fn:length(carrierList)}");
</script>
<fmt:message key="button.save" var="buttonSave"/>
<fmt:message key="button.cancel" var="buttonCancel"/>
<fmt:message key="button.delete" var="buttonDelete"/>

<fmt:message key="shippingRateDetail.title" var="shippingRateDetail" />
<probiz:ui_dialog id="EditShippingRate" width="600" height="420" title="${shippingRateDetail}"
					url="${ctxPath}/system/shippingRateBean/dialog.html?doAction=preShippingRateAction" buttons="'${buttonSave}':fnSaveShippingRate,'${buttonDelete}':fnDeleteShippingRate,'${buttonCancel}':dlgEditShippingRate_close" callback="fnInitADDShippingRateForm" />
<!-- *************** shippingRateForm.jsp引用：End *************** -->